/*
Copyright (C) 2009  Raymond Jeon
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/


#ifndef __GL_LIB_SERVICE_H__
#define __GL_LIB_SERVICE_H__



typedef struct
{
    int (*main_func)(int, char **);
    int connected;
    SERVICE_STATUS_HANDLE hServiceStatus;
    char *name;
    int exit_status;
    SERVICE_STATUS ssStatus;
    FILE *logFile;
} globdat_;

extern globdat_	globdat;

#ifdef WIN32

int GlServiceMain(int (*main_func)(int, char **), int argc, char **argv, char *service_name);
void GlServiceSetStatus(int status);
void GlInstallServiceMain();
void GlReinstallServiceMain();
void GlUninstallServiceMain();


#else	// unix

#define SERVICE_STOPPED                0x00000001
#define SERVICE_START_PENDING          0x00000002
#define SERVICE_STOP_PENDING           0x00000003
#define SERVICE_RUNNING                0x00000004
#define SERVICE_CONTINUE_PENDING       0x00000005
#define SERVICE_PAUSE_PENDING          0x00000006
#define SERVICE_PAUSED                 0x00000007
#define GlServiceSetStatus(status)	

#endif	// WIN32 


#endif	// __GL_LIB_SERVICE_H__


